import service from "@/utils/request"

import LoginWork from "@/utils/LoginWork"

export interface dataList{
    code:number,
    message:string,
    data:null
}

// 三级列表
export interface AThreeLevelListOfDepartmentDataInterface{
    typeNo: string,
    typeName: string,
    levelCode: string,
    parentLevel: null,
    oldLevel: 9,
    children: AThreeLevelListOfDepartmentDataInterface[]
}

export const AThreeLevelListOfDepartmentData = () => {
    return service.get<any,AThreeLevelListOfDepartmentDataInterface[]>('/common/getGeneralMaterialsList')
}

// 通用材料建档 
export interface GeneralMaterialFilePamrs{
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    vendor:string
}

export const GeneralMaterialFile = (parms:GeneralMaterialFilePamrs) => {
    return LoginWork.post<any,dataList>('/common/getGeneralMaterialsAdd',parms)
}

// 材料查询列表
export interface MaterialQueryListParms{
    mtlColor:string,
    mtlName:string,
    mtlName1:string,
    mtlName2:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    pageNum:number,
    pageSize:number,
    typeName:string,
    vendor:string
}

export interface MaterialQueryListInterface{
    total?: number,
    materialQueryList: materialQueryList[ ] 
}

interface materialQueryList{
    mtlNo: string,
    typeName: string,
    mtlColor: string,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    vendor: string,
    grossWeight: number,
    netWeight: null,
    area: null
}

export const MaterialQueryList = (parms:MaterialQueryListParms) => {
    return service.post<any,MaterialQueryListInterface>('/common/getMaterialQueryList',parms)
}

// 厂商数据
export const venderName = () => {
    return service.get<any,any>('/back/getVendorCompanyName')
}

// 材料查询删除
export const deleteMaterials = (mtlNo:string) => {
    return LoginWork.post<any,dataList>(`/common/getMaterialDel?mtlNo=${mtlNo}`,)
}